interface  identifiable{
    id:number;
}

interface  Timestamped {
    createdAt:Date;
}
class Records<T extends identifiable & Timestamped>{
    private items:T ;

    // 判断 createdAt 是否在最近7天内
    constructor(items:T){
        this.items=items;
    }
    isRecent(): boolean{
        const now=new Date();
        const sevenDaysAgo=new Date(now.getTime()-7*24*60*60*1000);
        return this.items.createdAt >= sevenDaysAgo;
    }
}
class User implements identifiable,Timestamped{
    id=1
    createdAt= new Date();
}

const user=new User();  //
const record=new Records<User>(user);
console.log(record.isRecent());